package cn.z2huo.knowledge.streamapi;

import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * <p>
 *
 * @author z2huo
 */
@Slf4j
class SkipLimitTest {

    public static void main(String[] args) {
        List<String> stringList = List.of("aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh");

        long page = 2L;
        long pageSize = 2L;

        List<String> list = stringList.stream().skip((page - 1) * pageSize).limit(pageSize).toList();
        log.info("当前页：{}，每页条数：{}，查询结果：{}", page, pageSize, list);
    }
}
